Python: astモジュール
Ref: https://docs.python.org/ja/3/library/ast.html
Pythonコードの抽象構文木を扱うモジュール
ast.walk(node)
nodeの子孫を再帰的にyieldする。
code:py
from collections import deque
todo = deque(node)
while todo:
node = todo.popleft()
todo.extend(iter_child_nodes(node))
yield node
compileのflagsにast.PyCF_ONLY_ASTを指定するとコードオブジェクトの代わりにASTを返す。